<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:p="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta value="description" content=""/>
    <meta value="keywords" content=""/>
    <meta value="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <title>CareVault</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css" th:href="@{/css/common/bootstrap-min.css}"/>
    <script th:src="@{/lib/jquery-3.1.1.min.js}"></script>
</head>
<body style="color:#3e3e3e;">
    <div style="width:700px; margin:0 auto;">
            <div class="header" style="height:40px; background:#2a78d4; color:#FFF; line-height:40px; position:relative;">
                <div style="font-size:18px; margin-left:20px;">CareVault - Neusoft</div>
                <div style="position:absolute; font-size:12px; right:10px;height:100%; top:0;">
                    订阅 | 首页 | 帮助
                </div>
            </div><!-- /header -->
            <br>

            <div class="body dagunzi">
                <div class="pass" style="padding:0 10px; display:none;">
                    <p>
                        <br> <br>
                        <h2 style="text-align:center; color:#545454;">
                            审批通过，感谢您提供的的数据！
                        </h2>
                        <br> <br>
                    </p>
                </div>

                <div class="tell-box haha" style="padding:0 10px;">
                    <p>尊敬的 会员，您好：</p>
                    <p>
                        [<span class="tou" style="font-weight:bold;"></span>] 项目需要用到您提供的数据资料，请您审批。以下为项目情况的详细信息。
                    </p>
                </div><!-- /tell-box -->
                <br>

                <div class="project-box" style="border:1px solid #efefef; padding:20px; position:relative;">
                    <img class="pass" style="display:none; position:absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto;" th:src="@{/images/indexBg4.png}">
                    <p>
                        项目名称：<span class="tou"></span>
                    </p>
                    <div>
                        <p>申请数据集：</p>
                        <div id="fu" style="text-indent:2em;"></div>
                    </div>
                    <div>
                        <p>项目成员：</p>
                        <div id="che" style="text-indent:2em;"></div>
                    </div>
                    <div>
                        申请日期：<span id="ri">2019-04-16 09:22:55</span>
                    </div>
                </div><!-- /project-box -->
            </div><!-- /body -->
            <br>

            <div class="agree-box haha" style="background:#edf1f1; text-align:center; height:120px; padding-top:20px;">
                <div>
                    <button
                        id="nidayede"
                        style="
                        background: #2a78d4;
                        color: #FFF;
                        border: 1px solid #2a78d4;
                        outline: none;
                        font-size: 18px;
                        border-radius: 3px;
                        padding: 10px 20px;
                    ">确认并同意使用</button>
                </div>
                <br>
                <div style="font-size:12px;">
                    此链接有效期为 7个 自然日。如果按钮已过期，<span style="color:blue;">我们将视为您不同意使用。</span>
                </div>
            </div><!-- /agree-box -->
            <br class="haha">

            <div class="lao-box haha" style="padding:0 10px;">
                如果您暂时未确定是否批准，并想通过线下的方式了解项目的背景和研究方向。请提交帮助请求或发送电子邮件至 tdd@neusoft.com。<br><br>
                谢谢！<br>
                Neusoft CareVault团队
            </div><!-- lao-box --><br>

            <div class="footer" style="height:40px; background:#d0d0d0; color:#9e9e9e;position:relative; line-height:40px; text-align:center; font-size:12px;">
                    高质量数据与知识库 | 认知模型服务 | 大数据平台 | 云计算架构
            </div><!-- /footer -->
    </div><!-- /row -->
    <div th:replace="lib :: javascript_box"></div>
    <script>
        let token = '[[${{token}}]]';
        let url = '[[${{url}}]]';
        let type = {
            O: '开放',
            R: '科研',
            L: '限权',
            P: '私有'
        };
        $.get(url + '/' + token, function (data) {
            var project = data.data.project
                , assets = data.data.assets
                , members = data.data.project_members;
            var str = [];

            $('.tou').html(project.name);
            $.each(assets, function (index, node) {
                str.push('<p style="font-weight:bold;">' + node.name + ' [' + node.file_name + '] <span style="color: #CCC; font-size: 12px; margin-left: 10px;">' + type[node.type] + '</span></p>');
            });
            $('#fu').html(str.join(''));

            str = [];
            $.each(members, function (index, node) {
                str.push('<p>' + node.name + ' (' + node.associator_name + ')</p>');
            });
            $('#che').html(str.join(''));
        });

        $('#nidayede').click(function () {
            jQuery.ajax ({
                url: url + '/submit/' + token,
                type: "POST",
                data: '朕知道了，准奏！',
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (res) {
                    $('.haha').remove();
                    $('.pass').show(0);
                }
            });
        });

    </script>
</body>
</html>